// Place your application-specific JavaScript functions and classes here
// This file is automatically included by javascript_include_tag :defaults
var pageSize = 15;
var screenWidth = window.screen.width;
var screenHeight = window.screen.height;

if (window.navigator.userAgent.indexOf("Firefox")>=1) {
    screenWidth = window.screen.width + window.screen.width/9;
    screenHeight = window.screen.height + window.screen.height/9;
}

Ext.namespace('Ext.exampledata');

//处理结果
userTypeDataArray = [
    ['教职工用户'],
    ['管理部门用户']
    ]

//处理结果
purchaseTypeDataArray = [
    ['1','办公家具'],
    ['0','仪器设备和实验家具']
    ]

Ext.exampledata.natureDataArray = [
    ['全民'],
    ['集体'],
    ['联营'],
    ['股份合作'],
    ['外资'],
    ['个人独资'],
    ['有限责任'],
    ['股份有限']
    ]

ratingDataArray = [
    ['很差',1],
    ['差',2],
    ['一般',3],
    ['好',4],
    ['很好',5]
    ]

vendorStateDataArray = [
    ['启用'],
    ['禁用'],
    ['未审批']
    ]

stateDataArray = [
    ['启用'],
    ['禁用']
    ]

function AddFavorite(sURL, sTitle)
{
    try
    {
        window.external.addFavorite(sURL, sTitle);
    }
    catch (e)
    {
        try
        {
            window.sidebar.addPanel(sTitle, sURL, "");
        }
        catch (e)
        {
            alert("加入收藏失败，请使用Ctrl+D进行添加");
        }
    }
}
function SetHome(obj,vrl){
    try{
        obj.style.behavior='url(#default#homepage)';
        obj.setHomePage(vrl);
    }
    catch(e){
        if(window.netscape) {
            try {
                netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
            }
            catch (e) {
                alert("此操作被浏览器拒绝！\n请在浏览器地址栏输入“about:config”并回车\n然后将 [signed.applets.codebase_principal_support]的值设置为'true',双击即可。");
            }
            var prefs = Components.classes['@mozilla.org/preferences-service;1'].getService(Components.interfaces.nsIPrefBranch);
            prefs.setCharPref('browser.startup.homepage',vrl);
        }
    }
}

function auditingRender(value){
    if (value === null){
        value = "";
    }
    if(value === "通过"){
        return "<font color=green>通过</font>"
    }else if(value.indexOf("edit")>=0){
        return "<font color=blue>编辑</font>"
    }else if(value === "驳回"){
        return "<font color=red>驳回</font>"
    }else{
        return value;
    }
}

function purchaseTypeRender(value){
    if(value === 0){
        return "<font color=blue>仪器设备</font>"
    }else if(value === 1){
        return "<font color=green>办公家具</font>"
    }
}

